/*================================================================
*   Copyright (C) 2024 baichao All rights reserved.
*
*   文件名称：atexit.c
*   创 建 者：baichao
*   创建日期：2024年03月31日
*   描    述：
*
================================================================*/

#include <stdio.h>
#include <stdlib.h>

void cleanup1() { printf("Cleaning up...1\n"); }

void cleanup2() { printf("Cleaning up...2\n"); }

int main() {
  printf("Main program starts.\n");

  // 注册清理函数
  atexit(cleanup1);
  atexit(cleanup2);

  printf("Main program ends.\n");

  abort();
}
